{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## week04:优化课程表项目"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 老师要求：\n",
    "> 增加客户输入，输入指定时间格式，输出对应的课程表;  \n",
    "> 会员每天可以使用10次，非会员可以使用5次，在登录的时候判断。  \n",
    "\n",
    "* 实现效果：\n",
    "> 1.课程表对用户进行欢迎后，读取用户时间数据，接着可进行登录（实现客户输入功能）；  \n",
    "> 2.分3个登录板块：会员、非会员、注册（实现可注册为新用户）；  \n",
    "> 3.会员有10次查询机会；非会员有5次查询机会（实现了会员非会员不同次数区别）；  \n",
    "> 4.登录3次失败，5分钟后重试（实现了登录判断功能）；  \n",
    "> 5.即可自动查询，也可手动查询（实现了输入指定时间格式）。  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "欢迎来到whf课程表，让你轻松查看课表！\n",
      "（会员将有十次查询机会，非会员有五次查询机会）\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Author:Weihongfen\n",
    "# week04:优化课程表项目\n",
    "\n",
    "import datetime\n",
    "time = datetime.datetime.today().weekday()\n",
    "week_time = time + 1\n",
    "print('欢迎来到whf课程表，让你轻松查看课表！\\n（会员将有十次查询机会，非会员有五次查询机会）\\n')\n",
    "    \n",
    "user_data = [\"hongfen\",\"chencan\",\"fengyuan\"]\n",
    "password_data = [\"123\",\"456\",\"789\"]\n",
    "go = 0    \n",
    "while go == 0:\n",
    "    cvip = input(\"您的身份是：(1)会员 (2)非会员 (3)注册\\n\")\n",
    "\n",
    "    if cvip == \"1\":\n",
    "     while True:\n",
    "        count = 3\n",
    "        count -= 1\n",
    "        username = input(\"请输入您的账号：\")\n",
    "        password = input(\"请输入您的密码：\")\n",
    "        if username in user_data :\n",
    "            if password in password_data:\n",
    "            # 占位符%s\n",
    "                print(\"尊贵的会员您好！\")\n",
    "                vip = 10\n",
    "                go = 1\n",
    "                print(\"您有%s次机会查询课表\" % (vip))\n",
    "                break\n",
    "            else:\n",
    "                if count ==0:\n",
    "                    print(\"您已输入三次,请等待5分钟后再试\")\n",
    "                    break\n",
    "                else:\n",
    "                    print(\"您账号或密码有误，请重新输入，您还有%s次机会\"%(count))\n",
    "        else:\n",
    "            if count == 0:\n",
    "                print(\"您已输入三次，请等待5分钟后再试\")\n",
    "                break\n",
    "            else:\n",
    "                print(\"您账号或密码有误，请重新输入，您还有%s次机会\"%(count))\n",
    "    if cvip == \"2\":\n",
    "        vip = 5\n",
    "        print(\"您有%s次机会查询课表~\"%(vip))\n",
    "        go = 1\n",
    "        break\n",
    "    if cvip == \"3\":\n",
    "        print(\"欢迎您注册本课表\")\n",
    "        uusername = input(\"请输入您的拼音/英文名：\")\n",
    "        upassword = input(\"请输入您的密码：\")\n",
    "        user_data.append(uusername)\n",
    "        password_data.append(upassword)\n",
    "        go = 0\n",
    "while go == 1:\n",
    "    while vip !=0:\n",
    "        vip -= 1\n",
    "\n",
    "        choice = input(\"请输入‘查询当前课表’或‘手动查询课表’\")\n",
    "        if choice == \"查询当前课表\":\n",
    "            if   week_time ==1:\n",
    "                print(\"有课\");\n",
    "                print(\"8：00-10:35 新媒体分析\");\n",
    "                print(\"14:30-17:30 商务沟通\");\n",
    "            elif week_time ==2:\n",
    "                print(\"没课\");\n",
    "                print(\"10:35-12:00 大学英语（三）\");\n",
    "                print(\"14:30-17:30 公司财务分析与资本运作\");\n",
    "                print(\"18:45-21:00 马克思主义基本原理\");\n",
    "            elif week_time ==3:\n",
    "                print(\"有课\");\n",
    "                print(\"8:00-9:30 网络文案与创意写作\");\n",
    "                print(\"9:45-12:00 影视视听语言\");\n",
    "            elif week_time ==4:\n",
    "                print(\"有课\");\n",
    "                print(\"9:45-12:00 Python语言\");\n",
    "                print(\"16:10-17:30 大学英语（三）\");\n",
    "            elif week_time ==5:\n",
    "                print(\"有课\");\n",
    "                print(\"10:35-12:00 广告摄影\");\n",
    "\n",
    "            else:\n",
    "                print(\"周末休息\")\n",
    "                print(\"自由安排\")\n",
    "            print(\"结束\")\n",
    "            \n",
    "        if choice == \"手动查询课表\":\n",
    "            day = int(input(\"请输入您想查询的星期（1-7）\"))\n",
    "            if   day ==1:\n",
    "                print(\"有课\");\n",
    "                print(\"8：00-10:35 新媒体分析\");\n",
    "                print(\"14:30-17:30 商务沟通\");\n",
    "            elif day ==2:\n",
    "                print(\"没课\");\n",
    "                print(\"10:35-12:00 大学英语（三）\");\n",
    "                print(\"14:30-17:30 公司财务分析与资本运作\");\n",
    "                print(\"18:45-21:00 马克思主义基本原理\");\n",
    "            elif day ==3:\n",
    "                print(\"有课\");\n",
    "                print(\"8:00-9:30 网络文案与创意写作\");\n",
    "                print(\"9:45-12:00 影视视听语言\");\n",
    "            elif day ==4:\n",
    "                print(\"有课\");\n",
    "                print(\"9:45-12:00 Python语言\");\n",
    "                print(\"16:10-17:30 大学英语（三）\");\n",
    "            elif day ==5:\n",
    "                print(\"有课\");\n",
    "                print(\"10:35-12:00 广告摄影\");\n",
    "\n",
    "            else:\n",
    "                print(\"周末休息\")\n",
    "                print(\"自由安排\")\n",
    "            print(\"结束\")\n",
    "            \n",
    "    else:\n",
    "        print(\"您的查询机会已用完，可明天再来查询！\")\n",
    "        break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
